import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';
//单条查询
export const querySysApiScope = (params) => {
  params.head.transCode = 'querySysApiScope';
  return request({
    url: '/platform/sysApiScope/querySysApiScope',
    method: 'post',
    data: params
  })
}
//多条列表查询，支持条件查询
export const querySysApiScopeListPage = (params) => {
  params.head.transCode = 'querySysApiScopeListPage';
  return request({
    url: '/platform/sysApiScope/querySysApiScopeListPage',
    method: 'post',
    data: params
  })
}
//新增单条记录
export const saveSysApiScope = (params) => {
  params.head.transCode = 'saveSysApiScope';
  return request({
    url: '/platform/sysApiScope/saveSysApiScope',
    method: 'post',
    data: params
  })
}
//新增多条记录
export const saveSysApiScopeList = (params) => {
  params.head.transCode = 'saveSysApiScopeList';
  return request({
    url: '/platform/sysApiScope/saveSysApiScopeList',
    method: 'post',
    data: params
  })
}
//新增或修改单条记录
export const saveOrUpdateSysApiScope = (params) => {
  params.head.transCode = 'saveOrUpdateSysApiScope';
  return request({
    url: '/platform/sysApiScope/saveOrUpdateSysApiScope',
    method: 'post',
    data: params
  })
}


//新增或修改单条记录
export const saveOrUpdateSysApiScopeList = (params) => {
  params.head.transCode = 'saveOrUpdateSysApiScopeList';
  return request({
    url: '/platform/sysApiScope/saveOrUpdateSysApiScopeList',
    method: 'post',
    data: params
  })
}

//修改单条记录
export const updateSysApiScope = (params) => {
  params.head.transCode = 'updateSysApiScope';
  return request({
    url: '/platform/sysApiScope/updateSysApiScope',
    method: 'post',
    data: params
  })
}
//分类查询接口
export const querySysApiScopeTree = (params) => {
  params.head.transCode = 'querySysApiScopeTree';
  return request({
    url: '/platform/sysApiScope/querySysApiScopeTree',
    method: 'post',
    data: params
  })
}
//同步菜单
export const synchronizeSysApiScope = (params) => {
  params.head.transCode = 'synchronizeSysApiScope';
  return request({
    url: '/platform/sysApiScope/synchronizeSysApiScope',
    method: 'post',
    data: params
  })
}
//删除单条记录
export const deleteSysApiScope = (params) => {
  params.head.transCode = 'deleteSysApiScope';
  return request({
    url: '/platform/sysApiScope/deleteSysApiScope',
    method: 'post',
    data: params
  })
}

//删除多条记录
export const deleteSysApiScopeList = (params) => {
  params.head.transCode = 'deleteSysApiScopeList';
  return request({
    url: '/platform/sysApiScope/deleteSysApiScopeList',
    method: 'post',
    data: params
  })
}

//导出excel
export const exportSysApiScopeExcel = (params) => {
  downloadExcel({
    url: '/platform/sysApiScope/excelDownload/exportSysApiScopeExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
